package cn.bisoft.java.util.common;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtil
{
	/**
	 * <pre>
	 * 通过Google的GSON组件实现对象到字符串的转换
	 * </pre>
	 * @param obj 对象
	 * @return 字符串
	 */
	public static String object2String(Object obj)
	{
		GsonBuilder builder = new GsonBuilder();
		Gson gson = builder.create();
		return gson.toJson(obj);
	}

}
